/**
 * @Author: 雷◕‿◕宇
 * @Description: 构造方法
 * @Date: 2018/10/29
 */
void main() {
  var person = new Person("Tom", 20, "Male");
  person.work();
  var p1 = new Person.withName("John", "2");
  p1.work();
  var p2 = new Person.withAge(20, "male");
  p2.work();
}

class Person {
  String? name;
  int? age;

  final String? gender;

  Person(this.name, this.age, this.gender);

//  Person(String name, int age, String gender){
//    this.name = name;
//    this.age = age;
//    this.gender = gender;
//  }

  Person.withName(String? name, this.gender);

  Person.withAge(this.age, this.gender);

  void work() {
    print("${name} ${gender} ${age} Work...");
  }
}

class Student extends Person {
  Student(String name, int age, String gender) : super(name, age, gender);

  Student.withName({String? name, String? gender})
      : super.withName(name, gender);
}
